﻿<%@ WebHandler Language="C#" Class="ShowDetailLitigation" %>

using System;
using System.Web;
using System.Text;
using System.Data;
using Chenxin.Lib.Utility;
using Chenxin.Lib.Business;
using Chenxin.Lib.Business.BLL;

public class ShowDetailLitigation : AjaxHandlerBase
{
    /// <summary>
    /// 基本权限项
    /// </summary>
    public ShowDetailLitigation()
    {
        //诉讼详情
        htTypePermit.Add("showdetiallitigation", Constants.Permit_ShowDetialLitigation);
    }

    override public void RequestProcess(HttpContext context)
    {
        string strOp = context.Request["op"];
        string strResponse = "";
        switch (strOp.ToLower())
        {
            //获取实体
            case "getmodel":
                strResponse = GetModel(context);
                break;
            //获取实体
            case "getsubmodel":
                strResponse = GetSubModel(context);
                break;
            default:
                break;
        }
        context.Response.Write(strResponse);
    }

    /// <summary>
    /// 获取实体
    /// </summary>
    /// <param name="context"></param>
    /// <returns></returns>
    private string GetModel(HttpContext context)
    {
        try
        {
            Chenxin.Lib.Business.Entity.t_Business_LitigationInfo model = null;

            model = Chenxin.Lib.Business.DAL.t_Business_LitigationInfo.GetModel(new Guid(context.Request["modelid"]));

            if (model != null)
            {
                return retExecResult(Constants.ExecResult.Succ, "", model);
            }
            else
            {
                return retExecResult(Constants.ExecResult.Error, "数据不存在，获取信息失败！", "");
            }
        }
        catch (Exception ex)
        {
            return retExecResult(Constants.ExecResult.Error, ex.Message, "");
        }
    }

    /// <summary>
    /// 获取实体
    /// </summary>
    /// <param name="context"></param>
    /// <returns></returns>
    private string GetSubModel(HttpContext context)
    {
        try
        {
            Chenxin.Lib.Business.Entity.t_Business_LitigationSubInfo model = null;
            Chenxin.Lib.Business.BLL.LitigationSub bllLitigationSub = new Chenxin.Lib.Business.BLL.LitigationSub();
            model = bllLitigationSub.GetModel(new Guid(context.Request["modelid"]));

            if (model != null)
            {
                return retExecResult(Constants.ExecResult.Succ, "", model);
            }
            else
            {
                return retExecResult(Constants.ExecResult.Succ, "", "");
            }
        }
        catch (Exception ex)
        {
            return retExecResult(Constants.ExecResult.Error, ex.Message, "");
        }
    }
}